package sftp.testController;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import sftp.util.SingleNodeSftpUtils;

@Controller("SpringTestController")
@RequestMapping(value = "/receivePolicy", method = RequestMethod.POST)
@ResponseBody
public class SpringTestController {

    @RequestMapping(value = "/testSftpUpload", method = RequestMethod.POST)
    public static String testSftpUpload(String sourceFile, String destinationFile) {
        System.out.println("testSftpUpload");
        boolean upload = SingleNodeSftpUtils.upload(sourceFile, destinationFile);
        return upload ? "true" : "false";

    }
}
